#include <stdio.h>
#include <stdlib.h>
#include "tree.h"

static void find_(node_st *ptr)
{
	char find_[KEYSIZE] = {0};
	int ret = 0;
	scanf("%s",find_);
	ret = find(ptr,find_);
	if(ret)
	{
		printf("%d\n",ret);
	}
	else
	{
		printf("No Find!\n");
	}
}


int main(int argc,char **argv)
{
	if(argc < 2)
	{
		fprintf(stderr,"Usage:%s\n",argv[0]);
		exit(1);
	}

	FILE *fps;
	fps = fopen(argv[1],"r");
	if(fps == NULL)
	{
		perror("fopen");
		exit(1);
	}
	node_st *ptr = NULL;
	func(&ptr,fps);
	find_(ptr);
	fclose(fps);
		exit(0);
}
